package com.zzyl;


import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.http.Method;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.zzyl.service.impl.WechatServiceImpl;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.HashMap;
import java.util.Map;

@SpringBootTest
public class test {

    @Test
    public void test() {
        Map<String, Object> map = new HashMap<>();
        map.put("pageNum", "1");
        map.put("pageSize", "10");
        String s = HttpUtil.get("http://localhost:9995/nursing_project", map);
        JSONObject jsonObject = JSONUtil.parseObj(s);
        JSONObject data = (JSONObject) jsonObject.get("data");
        Object records = data.get("records");
        System.out.println(records);

    }
    @Test
    public void test1(){

      String  appcode="4abb4991275049a4a7a707b2ba3e1a4f";
        Map<String,Object> map = new HashMap<>();
        map.put("area","丽江");
        map.put("areaCode","530700");
//        String s = HttpUtil.get("http://localhost:9995/nursing_project", map);
//        JSONObject jsonObject = JSONUtil.parseObj(s);
//        JSONObject data = (JSONObject) jsonObject.get("data");
//        Object records = data.get("records");
        HttpResponse response = HttpUtil.createRequest(Method.GET, "https://ali-weather.showapi.com/day15")
                .header("Authorization", "APPCODE " + appcode)
                .form(map).execute();
        System.out.println(response);

    }

    @Test
    public void test2(){
        String openId = new WechatServiceImpl().getOpenId("0b3eEFll2evxTe4Nx2ml2BI7mS2eEFlO");
        System.out.println(openId);

    }

}
